new Vue({
	el: ".notsvue",
	data() {
		return {
			ip: IPCMS,
			url: "/index.php/api/Notes",
			pageid: "",
			notsdata: {},
		}
	},
	methods: {
		//获取URL参数
		getequest() {
			var url = location.search; //获取url中"?"符后的字串   
			var theRequest = new Object();
			if(url.indexOf("?") != -1) {
				var str = url.substr(1);
				strs = str.split("&");
				for(var i = 0; i < strs.length; i++) {
					theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
				}
			}
			return theRequest;
		},
		//获取数据
		getData() {
			var u = this.getequest();
			var http = this.ip + this.url + "/" + u.id;
			this.$http.jsonp(http).then(res => {
				var body = res.body;
				this.notsdata = body;
//				console.log("===" + JSON.stringify(body));
			}).catch(res => {
				console.log("请求出错");
			})
		},
		//时间格式
		timestampToTime(timestamp) {
			var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
			var Y = date.getFullYear() + '-';
			var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
			// var D = date.getDate() + ' ';
			var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
			// var m = date.getMinutes() + ':';
			var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
			// var s = date.getSeconds();
			var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
			return Y + M + D + h + m + s;
		}
	},
	created() {
		this.getData();
	},
});
new Vue({
	el:".go",
	methods:{
		/**
		 * 返回上一页
		 */
		histroygo(){
			history.go(-1);
		},
	}
})